package com.example.app.components.MyTab

import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.PrimaryTabRow
import androidx.compose.material3.TabIndicatorScope
import androidx.compose.material3.TabRowDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun MyPrimaryTabRow(
        selectedTabIndex: Int,
        modifier: Modifier = Modifier,
        containerColor: Color = Color.Transparent,
        contentColor: Color = TabRowDefaults.primaryContentColor,
        indicator: @Composable TabIndicatorScope.() -> Unit = {
            TabRowDefaults.PrimaryIndicator(
                color = MaterialTheme.colorScheme.surface,
                modifier = Modifier.tabIndicatorOffset(
                    selectedTabIndex,
                    matchContentSize = false
                ),
                width = 12.dp,
            )
        },
        divider: @Composable () -> Unit = @Composable {
            HorizontalDivider()
        },
        tabs: @Composable () -> Unit
) {
    PrimaryTabRow(
        selectedTabIndex,
        modifier,
        containerColor,
        contentColor,
        indicator,
        divider,
        tabs
    )
}